/**
 * 设置导航栏标题
 * @param  {String} title
 */
export const changeTitle = (title) => {
  try {
    window.hscf.changeTitle(title);
  } catch (error) {}
}

/**
 * 获取登录tokne
 * @return {String}
 */
export const getToken = () => {
  let token = '';
  try {
    token = window.hscf.getToken('');
  } catch (e) {

  }
  return token;
}

/**
 * 关闭webview
 */
export const closeWebView = (show = true) => {
  try {
    window.hscf.closeWebView(show);
  } catch (e) {}
}

/**
 * 显示分享
 */
export const setShareBtnVisiable = (show = false) => {
  try {
    window.hscf.setShareBtnVisiable(show);
  }catch(e) {}
}

/**
 * 跳转
 */
export const goToSee = (url) => {
  try {
    window.hscf.goToSee(url);
  } catch(e) {
  	alert(e.message);
  }
}

/**
 * 设置导航栏是否显示
 * @param  {Boolean} show
 */
export const setTitleVisiable = (show = true) => {
  try {
   window.hscf.setTitleVisiable(show);
  } catch (err) {}
}

/**
 * 分享
 * @param  {Object} obj 分享参数
 * @return {[type]}     [description]
 */
export const shareActive = (obj) => {
  try {
    window.hscf.shareActive(JSON.stringify(obj));
  } catch(e) {}
}

export const showLogin = (show = true) => {
  try {
    window.hscf.showLogin(show);
  } catch(e) {
    // statements
  }
}

export default{
  changeTitle,
  getToken,
  closeWebView,
  setShareBtnVisiable,
  goToSee,
  setTitleVisiable,
  shareActive,
  showLogin
}
